package cn.tedu.boot522.mapper;

import cn.tedu.boot522.entity.Weibo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WeiboMapper {

    @Insert("insert into weibo values(null,#{content},#{urls},#{nick},#{created},#{userId})")
    public void insert(Weibo weibo);

    @Select("select * from weibo order by created desc")
    List<Weibo> select();

    @Select("select * from weibo where id=#{id}")
    Weibo selectByWeiboId(int id);

    @Select("select * from weibo where user_id=#{userId}")
    List<Weibo> selectSelf(Integer id);

    @Delete("delete from weibo where id=#{id}")
    void delete(int id);
}
